﻿using System;
using System.ServiceModel;

namespace Arete
{
    public interface IMyEvents
    {
        [OperationContract(IsOneWay = true)]
        void Event1();

        [OperationContract(IsOneWay = true)]
        void MessageEvent(object obj, MessageEventArgs e);
    }

    [ServiceContract(CallbackContract = typeof(IMyEvents))]
    public interface IMyContract
    {
        [OperationContract]
        void SubscribeEvent();

        [OperationContract]
        void DoSomethingAndFireEvent();

        [OperationContract]
        void SendMessageAndFireEvent(string message);
    }

    [Serializable]
    public class MessageEventArgs : EventArgs
    {
        protected string msg;
        public string MessageText
        {
            get { return msg; }
            set { msg = value; }
        }  
        #region ctor 
        protected MessageEventArgs() { }
        public MessageEventArgs(string message) { msg = message; }
        #endregion ctor 
        
    }
}
